import { redirect } from "next/navigation"
import { getServerSession } from "next-auth"
import { authOptions } from "@/lib/auth"
import { Button } from "@/components/ui/button"
import Link from "next/link"

export default async function AdminPage() {
  const session = await getServerSession(authOptions)
  
  if (!session?.user?.isAdmin) {
    redirect("/")
  }

  return (
    <div className="max-w-4xl mx-auto p-8">
      <h1 className="text-2xl font-bold mb-6">管理后台</h1>
      
      <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
        <Link href="/admin/libraries">
          <Button className="w-full h-24 text-lg" variant="outline">
            事件库管理
          </Button>
        </Link>
        
        <Link href="/admin/events">
          <Button className="w-full h-24 text-lg" variant="outline">
            历史事件管理
          </Button>
        </Link>

        <Link href="/admin/users">
          <Button className="w-full h-24 text-lg" variant="outline">
            用户管理
          </Button>
        </Link>

        <Link href="/admin/stats">
          <Button className="w-full h-24 text-lg" variant="outline">
            数据统计
          </Button>
        </Link>
      </div>
    </div>
  )
} 